import { WrappedFormMethods } from 'rc-form';
import { IEditor } from '../../defines/application';

export type IMode = 'detail' | 'edit';

export const Properties: IEditor[] = [
  {
    field: 'name',
    text: 'Label',
    type: 'string',
    specialType: 'title'
  },
  // {
  //   field: 'code',
  //   text: 'Code',
  //   type: 'string',
  // },
  {
    text: 'Validate',
    type: 'group',
    data: [
      {
        field: 'required',
        text: 'Required',
        type: 'boolean'
      }
    ]
  },
  // {
  //   field: 'disabled',
  //   text: 'Disabled',
  //   type: 'boolean',
  // },
  // 高级设置
  {
    group: 'Advanced', // 分组 --- 高级设置 or 基础设置(默认)
    field: 'visibleConditions',
    text: 'Condition',
    type: 'Condition'
  }
];

export const CurrencyArray: any[] = [
  {
    text: '人民币(元)',
    value: 'rmb',
    currencyType: '元'
  },
  {
    text: '日元',
    value: 'jpy',
    currencyType: '日元'
  },
  {
    text: '美元',
    value: 'usd',
    currencyType: '美元'
  }
];

// export interface IForm extends WrappedFormMethods {
//   setFieldsValue(arg0: { [x: string]: { value: any; text: any } });
//   getFieldProps: (code: string, props: object) => {};
// }

export class CommonProps {
  public className = '';
  // public style: React.CSSProperties = {};
  public error?: any;
  public onErrorClick?= () => {//
  };
  public name = 'ComponentName'; // 空间名称
  public code = ''; // 控件编码
  public required = true; // 是否必填
  public disabled = false; // 是否禁用
  public form?: WrappedFormMethods;
  public value?: any;
  public onChange?: (params: any, params2?: any) => void;
  public renderMode?: FormRenderModes;
  public permission?: any
}
